class MyMeta(type):  # 1. 继承type
    def __init__(self, class_name, class_base, class_dic):
        # 判断类名的首字母是否大写
        if not class_name.istitle():
            raise TypeError('类名的首字母必须大写')

        # __doc__ 类的注释检查
        if '__doc__' not in class_dic or not class_dic['__doc__'].stript():
            raise TypeError('必须有注释， 且注释不能为空')

        # 调用父类
        super(MyMeta, self).__init__(class_name, class_base, class_dic)


class Chiness(object, metaclass=MyMeta):  # 2. 继承时，设置metaclass参数
    country = 'China'

    def __init__(self, name, age):
        self.name = name
        self.age = age

    def talk(self):
        print("%s is talking" % self.name)
